package com.example.zhangxin.comevedio.activity;

import android.app.Activity;
import android.app.Application;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by ZhangXin on 2016/9/13.
 */

public class MyApplication extends Application {
    private static MyApplication mApp;
    private static List<Activity> list;
    @Override
    public void onCreate() {
        super.onCreate();
        mApp = this;
        list = new ArrayList<>();
    }

    public static void addActivity(Activity activity){
        list.add(activity);
    }

    public static void removeActivity(Activity activity){
        list.remove(activity);
    }

    public static void finishAll(){
        for (Activity activyty:list
             ) {
            if(activyty!=null){
                activyty.finish();
            }
        }
    }

    public static MyApplication getContent(){
        return mApp;
    }

}
